<template>
  <el-dialog
    :close-on-click-modal="false"
    :before-close="cancel"
    :visible="visible"
    :title="$t('vip.vip17')"
    width="650px"
  >
    <el-form ref="ruleForm" :model="ruleForm" label-width="130px">
      <el-form-item :label="$t('vip.vip1')">
        <el-input v-model="ruleForm.account" disabled />
      </el-form-item>
      <el-form-item :label="$t('vip.vip2')">
        <el-input v-model="ruleForm.nickname" disabled />
      </el-form-item>
      <el-form-item :label="$t('vip.vip14')">
        <el-input v-model="ruleForm.real_name" disabled />
      </el-form-item>
      <el-form-item :label="$t('vip.vip3')">
        <el-select
          v-model="ruleForm.open_status"
          disabled
          :placeholder="$t('vip.vip3')"
        >
          <el-option
            v-for="item in openOption"
            :key="item.id"
            :label="item.value"
            :value="Number(item.id)"
          />
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('vip.vip20')">
        <el-input
          :value="
            ruleForm.account_login_log && ruleForm.account_login_log[0]
              ? ruleForm.account_login_log[0].login_ip
              : '--'
          "
          disabled
        />
      </el-form-item>
      <el-form-item :label="$t('vip.vip19')">
        <el-input
          :value="
            ruleForm.account_login_log && ruleForm.account_login_log[0]
              ? ruleForm.account_login_log[0].region
              : '--'
          "
          disabled
        />
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
<script>
import { openOption } from "@/assets/js/common";
import { CusInfo } from "@/api/vip/vip";
export default {
  data() {
    return {
      openOption,
      visible: false,
      ruleForm: {},
    };
  },
  methods: {
    init(rowID) {
      CusInfo(rowID)
        .then((res) => {
          if (res.code == 10000) {
            this.ruleForm = res.data;
            this.visible = true;
          } else {
            this.$message.error(res.message);
          }
        })
        .catch((error) => {
          this.$message.error(error.Error);
        });
    },
    cancel() {
      this.visible = false;
      this.ruleForm = {};
    },
  },
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
  padding-top: 0;
}
.el-select {
  width: 100%;
}
</style>
